package com.lagou.exam;

import java.io.Serializable;
import java.util.Random;

// 自定义一个考题类，目前支持选择题，四个选项，存储一个正确答案，以及分值
public class ExamQuestion implements Serializable {

    private static final long serialVersionUID = -6813327622136378394L;
    private int id; //考题id
    private int score; //这一题的分值

    public ExamQuestion() {
        id = ServerRandom.getRandomId();
    }

    // 先定义一个修改考题的接口
    public void modify(ExamQuestion question) {
        setScore(question.getScore()); //目前修改分值
    }

    public void modify(int score) {
        setScore(score); //修改分值
    }

    public int getId() {
        return id;
    }

    public int getScore() {
        return score;
    }

    private void setScore(int score) {
        this.score = score;
    }

    @Override
    public String toString() {
        return "ExamQuestion{" +
                "id=" + id +
                ", score=" + score +
                '}';
    }
}
